import { Component, OnInit, ChangeDetectorRef, ViewChild } from '@angular/core';
import { FloatingWindowAddComponent } from './floating-window-add/floating-window-add.component';
import { FloatingWindowGridComponent } from './floating-window-grid/floating-window-grid.component';
import { masterService } from '../../../../lib/master.service';
import { path } from '../../../path.config';

@Component({
    selector: 'floating-window',
    templateUrl: './floating-window.component.html',
    styleUrls: ['./floating-window.component.css']
})
export class FloatingWindowComponent implements OnInit {
    @ViewChild('floatingWindowAdd') public floatingWindowAdd: FloatingWindowAddComponent;
    @ViewChild('floatingWindowGrid') private floatingWindowGrid: FloatingWindowGridComponent;

    ngOnInit() { }

    openModal() {
        this.floatingWindowAdd.newHomepage.show();
    }

    public filter: any = {
        pageName: '',
        pageSize: '10',
        pageIndex: '1'
    }

    constructor(private _masterService: masterService,
                private cdRef: ChangeDetectorRef) { }

    // 筛选首页弹窗列表
    public selectListItem() {
        this.floatingWindowGrid.onChangeTable(this.filter, '1');
    }

    // 新建确认后触发
    homePageAddFunc() {
        this.floatingWindowGrid.onChangeTable(this.filter, '1');
    }
}
